package model;

import basics.ConversaoDeBases;

public class TipoR extends Instrucao {

	private String rs; // Código do registrador rs
	private String rt; // Código do registrador rt
	private String rd; // Código do registrador rd
	private String shamt;
	private String function;

	protected TipoR() {

	}

	protected String getRs() {
		return rs;
	}

	protected void setRs(String rs) {
		this.rs = rs;
	}

	protected String getRt() {
		return rt;
	}

	protected void setRt(String rt) {
		this.rt = rt;
	}

	protected String getRd() {
		return rd;
	}

	protected void setRd(String rd) {
		this.rd = rd;
	}

	protected String getShamt() {
		return shamt;
	}

	protected void setShamt(String shamt) {
		this.shamt = shamt;
	}

	protected String getFunction() {
		return function;
	}

	protected void setFunction(String function) {
		this.function = function;
	}
	
	protected String getRsInHex() {
		return rs;
	}
	
	protected String getRtInHex() {
		return ConversaoDeBases.binToHex(rt);
	}
	
	protected String getRdInHex() {
		return ConversaoDeBases.binToHex(rd);
	}

	protected String getShamtInHex() {
		return ConversaoDeBases.binToHex(shamt);
	}
	
	protected String getFunctionInHex() {
		return ConversaoDeBases.binToHex(function);
	}


	@Override
	public String toString() {
		return this.getEnderecoInHex() + ":\top= " + super.getOpInHex() + " TipoR [rs="
				+ this.getRsInHex() + ", rt=" + this.getRtInHex() + ", rd=" + this.getRdInHex() + ", shamt=" + this.getShamtInHex()
				+ ", function=" + this.getFunctionInHex() + "]";
	}

	@Override
	public String getInstrucao() {
		return super.getOp() + this.getRs() + this.getRt() + this.getRd()
				+ this.getShamt() + this.getFunction();
	}

}
